/*
 * 文件名：RealsocksUserDaoImpl.java
 * 版权：亚信联创版权所有
 * 描述：TODO
 * 修改人：yuanze
 * 修改时间：2014年11月2日
 * 修改内容：TODO
 */
package com.ailk.bigdata.etl.realstream.server.dao.impl;

import java.sql.Connection;
import java.sql.SQLException;

import org.apache.commons.dbutils.BasicRowProcessor;
import org.apache.commons.dbutils.ResultSetHandler;
import org.apache.commons.dbutils.handlers.BeanHandler;

import com.ailk.bigdata.etl.common.server.database.JdbcUtil;
import com.ailk.bigdata.etl.common.server.database.beanprocessor.HumpMatcher;
import com.ailk.bigdata.etl.common.server.database.beanprocessor.MyBeanProcessor;
import com.ailk.bigdata.etl.realstream.server.dao.RealsocksUserDao;
import com.ailk.bigdata.etl.realstream.server.model.RealsocksUser;
import com.ailk.bigdata.etl.realstream.server.tools.RealStreamTool;

/**
 * @description TODO
 * @author [yuanze]
 * @version [版本号,2014年11月2日]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
public class RealsocksUserDaoImpl implements RealsocksUserDao
{

	private static String findByUserName = "SELECT *  FROM TD_REALSOCKS_USER WHERE USER_ACCT=?";

	/**
	 * @see com.ailk.bigdata.etl.realstream.server.dao.RealsocksUserDao#findByUserName(java.lang.String)
	 */
	public RealsocksUser findByUserName(String userName)
	{
		// Connection conn = JdbcUtil.getConnection("org.postgresql.Driver",
		// "jdbc:postgresql://192.168.11.201:9532/etldb", "etl", "etl");
		Connection conn = JdbcUtil.getConnectByPool(RealStreamTool.dbInfo);
		RealsocksUser user = null;
		try
		{
			@SuppressWarnings({ "unchecked", "rawtypes" })
			ResultSetHandler<RealsocksUser> handler = new BeanHandler(RealsocksUser.class, new BasicRowProcessor(new MyBeanProcessor(
					new HumpMatcher())));
			user = JdbcUtil.query(conn, true, handler, findByUserName, userName);
		}
		catch (SQLException e)
		{
		}
		return user;
	}
	
}
